Skip to main content

All Questions

0votes
3answers
235views

How to filter "locally and remotely" in functional programming

My example applies to reading and deleting files (I/O), but this is probably a common scenario (eg, keeping local and global state in sync in functional programming). I am reading in files from a ...
rpivovar's user avatar
3votes
3answers
304views

How to "pass through" data in a functional programming pipeline so that it's accessible later on in the pipeline

I am trying to refactor some JavaScript code to use functional programming principles. I have some functions that I want to use in a series of maps. const transformedData = rawData .map(...
rpivovar's user avatar
5votes
3answers
616views

Are "pipelines" in functional programming bad for time complexity?

This question is not meant to be a critique of functional programming, but more hoping for resources and opinions. I am refactoring some historically messy code so that it follows functional ...
rpivovar's user avatar
1vote
2answers
324views

Why did TC39 name JavaScript's array predicate functions `some` and `every` instead of `any` and `all`?

Python, Ruby, Rust, Haskell, Kotlin, C#, C++, Perl, MATLAB, SQL, and R all call their respective array predicate checking functions any and all. Is there any record of why JavaScript's designers ...
Alex Ryan's user avatar
0votes
2answers
759views

Should I use unnecessary function for readability sake

I am implementing if/else statement, by using function "inCase" to make it more readable: const size = 'small' const equals = str1 => str2 => str2 === str1 const inCase = (obj) => ...
Djordje Vuckovic's user avatar
4votes
3answers
963views

Is this extensive usage of closure a known (anti-)pattern? And does it have a name?

I often use function closures for storing data (e.g. database URL), which doesn't change between function calls. Is this an (anti-)pattern? Does it have a name? While developing apps, which recieve ...
Sebastian DonnerWolfBach's user avatar
16votes
10answers
7kviews

Are immutable objects important only in multi-threaded applications and if so, how are shared immutable objects useful?

I think the answer to the first part of my question is, "yes" -- no point in making objects immutable in a single-threaded application (or I guess in a multi-threaded application if that ...
releseabe's user avatar
12votes
2answers
5kviews

A real-life example of using curry function? [closed]

I was struggled to find a real-life example of using curry function and get the benefit of using curry. When I google curry function I often see the example like let add = x => y => x + y; let ...
Qiulang 邱朗's user avatar
1vote
4answers
471views

In Haskell, is it a "violation" of functional programming to interact with something that was not a function parameter?

I'm sure this must have been asked before, but I can't find anywhere that actually answers my question, so apologies if I have simply overlooked this. I am currently learning Haskell, and loving the ...
Raiden616's user avatar
3votes
1answer
1kviews

How do functional programming advocates use a framework like React or Angular?

I read this blog post recently: The Two Pillars of JavaScript Part 1: How to Escape the 7th Circle of Hell, which is essentially a criticism of object oriented programming, and advocacy for funtional ...
dwjohnston's user avatar
0votes
1answer
177views

Is the usage of flip function a smell for bad design?

Everything is in the title, is the usage of flip function a smell for bad design ? I'm coming from a JavaScript universe and used to work with lodash/fp or ramda. Recently, I've written some stuff ...
mfrachet's user avatar
1vote
0answers
563views

Understanding transducers, why this is not a transducer

I'm currently learning functional programming and trying to learn a new concept : transducers. I'm actually getting the point of theory, like it's an advanced map/reduce that aims to provide better ...
mfrachet's user avatar
10votes
1answer
796views

Why most anonymous functions can't be JIT compiled and will never be optimized?

I just read https://techfindings.one/archives/2652 about functional programming and came accross this: anonymous functions can often not be JIT compiled and will never be optimized Can someone ...
thadeuszlay's user avatar
4votes
2answers
484views

What are the correct functional programming terms for what I'm doing here?

I recently needed a function to deep clone an object. I started with the code given as an accepted answer to this question: https://stackoverflow.com/a/728694/1253156 However, our SonarQube ...
Patrick Hund's user avatar
9votes
2answers
791views

How can I _read_ functional JavaScript code?

I believe I have learned some/many/most of the basic concepts underlying functional programming in JavaScript. However, I have trouble specifically reading functional code, even code I've written, and ...
Andrew Willems's user avatar

153050per page
close